import Vue from 'vue'

import 'normalize.css/normalize.css' // A modern alternative to CSS resets

//引入element-ui:全部引入，没有做按需加载
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import router from './router'

import '@/icons' // icon
import '@/permission' // permission control

/**
 * If you don't want to use mock-server
 * you want to use MockJs for mock api
 * you can execute: mockXHR()
 *
 * Currently MockJs will be used in the production environment,
 * please remove it before going online ! ! !
 */
//processon:webpack提供一个全局变量，可以直接使用！！！检测当前项目模式【开发、生产】
if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}





// set ElementUI lang to EN
// Vue.use(ElementUI, { locale })
// 如果想要中文版 element-ui，按如下方式声明
Vue.use(ElementUI)

Vue.config.productionTip = false

//引入将来需要反请求的哪些接口函数

import API  from '@/api';
//定义全局组件:分类
import Category from '@/components/Category';
import HintButton from '@/components/HintButton';
//组件的名字【字符串】  相应的组件
Vue.component(Category.name,Category);
Vue.component(HintButton.name, HintButton);
import {isShow} from '@/utils/showButton';
new Vue({
  beforeCreate(){
   //配置全局事件总线的地方:VM原型对象与组件实例的原型的原型指向的是同一个对象【Vue.prototype】
   Vue.prototype.$API = API;
   Vue.prototype.isShow = isShow;
  },
  el: '#app',
  router,
  store,
  render: h => h(App)
})
